<!DOCTYPE html>
<html>
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="utf-8">
  

  
  <title>Tomcat内存溢出跟踪 | </title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="baidu-site-verification" content="T7hOozd75A">
  <meta name="description" content="1.内存溢出dump输出运行时输入jmap -dump:format=b,file=data.dump [pid] 1jmap -dump:format=b,file=data.dump 16048 Window在catalina.bat 的头部增加如下内容  1set JAVA_OPTS=-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=../l">
<meta name="keywords" content="tomcat,内存溢出">
<meta property="og:type" content="article">
<meta property="og:title" content="Tomcat内存溢出跟踪">
<meta property="og:url" content="http://lowezheng.gitee.io/2018/11/29/tomcat/index.html">
<meta property="og:site_name">
<meta property="og:description" content="1.内存溢出dump输出运行时输入jmap -dump:format=b,file=data.dump [pid] 1jmap -dump:format=b,file=data.dump 16048 Window在catalina.bat 的头部增加如下内容  1set JAVA_OPTS=-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=../l">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="https://note.youdao.com/yws/public/resource/94499522f655a23f19ca6054cd2b27db/4757765F65ED41398E7325AE8F9F5A27?ynotemdtimestamp=1543478406102">
<meta property="og:image" content="https://note.youdao.com/yws/public/resource/94499522f655a23f19ca6054cd2b27db/E56FE7483BEA44659DE08565B09A55CB?ynotemdtimestamp=1543478406102">
<meta property="og:updated_time" content="2018-12-04T00:49:31.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Tomcat内存溢出跟踪">
<meta name="twitter:description" content="1.内存溢出dump输出运行时输入jmap -dump:format=b,file=data.dump [pid] 1jmap -dump:format=b,file=data.dump 16048 Window在catalina.bat 的头部增加如下内容  1set JAVA_OPTS=-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=../l">
<meta name="twitter:image" content="https://note.youdao.com/yws/public/resource/94499522f655a23f19ca6054cd2b27db/4757765F65ED41398E7325AE8F9F5A27?ynotemdtimestamp=1543478406102">
  
    <link rel="alternate" href="/atom.xml" title="" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link rel="stylesheet" href="/css/style.css">
</head>
</html>
<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo"></a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">主页</a>
        
          <a class="main-nav-link" href="/archives">文档库</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="搜索"></a>
      </nav>
      <div id="search-form-wrap">
        <form target="_blank" action="http://zhannei.baidu.com/cse/site" class="search-form">
            <input type="text" name="q" class="search-form-input" size="30">
            <input type="hidden" name="cc" value="lowezheng.gitee.io">
        </form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main"><article id="post-tomcat" class="article article-type-post" itemscope="" itemprop="blogPost">
  <div class="article-meta">
    <a href="/2018/11/29/tomcat/" class="article-date">
  <time datetime="2018-11-29T07:58:30.000Z" itemprop="datePublished">2018-11-29</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      Tomcat内存溢出跟踪
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <hr>
<h2 id="1-内存溢出dump输出"><a href="#1-内存溢出dump输出" class="headerlink" title="1.内存溢出dump输出"></a>1.内存溢出dump输出</h2><p>运行时输入jmap -dump:format=b,file=data.dump [pid]</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">jmap -dump:format=b,file=data.dump 16048</span><br></pre></td></tr></table></figure>
<h3 id="Window"><a href="#Window" class="headerlink" title="Window"></a>Window</h3><p>在catalina.bat 的头部增加如下内容</p>
<p><img src="https://note.youdao.com/yws/public/resource/94499522f655a23f19ca6054cd2b27db/4757765F65ED41398E7325AE8F9F5A27?ynotemdtimestamp=1543478406102" alt="image"></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">set</span> JAVA_OPTS=-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=../logs/oom.hprof</span><br></pre></td></tr></table></figure>
<h3 id="Linux"><a href="#Linux" class="headerlink" title="Linux"></a>Linux</h3><p>在catalina.sh的头部增加如下内容</p>
<p><img src="https://note.youdao.com/yws/public/resource/94499522f655a23f19ca6054cd2b27db/E56FE7483BEA44659DE08565B09A55CB?ynotemdtimestamp=1543478406102" alt="image"></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">JAVA_OPTS=<span class="string">"-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=../logs/oom.hprof"</span></span><br></pre></td></tr></table></figure>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://lowezheng.gitee.io/2018/11/29/tomcat/" data-id="cjp9hvyb600015yf0vzzp1ivu" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/tomcat/">tomcat</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/内存溢出/">内存溢出</a></li></ul>

    </footer>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/2018/11/29/openssl/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Newer</strong>
      <div class="article-nav-title">
        
          Openssl自建CA
        
      </div>
    </a>
  
  
</nav>

  
</article>

</section>
        
          <aside id="sidebar">
  
    

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">标签</h3>
    <div class="widget">
      <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/EMQX/">EMQX</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/MQTT/">MQTT</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/ca/">ca</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/openresty/">openresty</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/openssl/">openssl</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/tomcat/">tomcat</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/zookeeper/">zookeeper</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/内存溢出/">内存溢出</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/反向代理/">反向代理</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/安装/">安装</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/自建证书/">自建证书</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">标签云</h3>
    <div class="widget tagcloud">
      <a href="/tags/EMQX/" style="font-size: 10px;">EMQX</a> <a href="/tags/MQTT/" style="font-size: 10px;">MQTT</a> <a href="/tags/ca/" style="font-size: 10px;">ca</a> <a href="/tags/openresty/" style="font-size: 10px;">openresty</a> <a href="/tags/openssl/" style="font-size: 10px;">openssl</a> <a href="/tags/tomcat/" style="font-size: 10px;">tomcat</a> <a href="/tags/zookeeper/" style="font-size: 10px;">zookeeper</a> <a href="/tags/内存溢出/" style="font-size: 10px;">内存溢出</a> <a href="/tags/反向代理/" style="font-size: 10px;">反向代理</a> <a href="/tags/安装/" style="font-size: 10px;">安装</a> <a href="/tags/自建证书/" style="font-size: 10px;">自建证书</a>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">归档</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/12/">十二月 2018</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/11/">十一月 2018</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">最新文章</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2018/12/04/mac-command/">Mac指令集合</a>
          </li>
        
          <li>
            <a href="/2018/12/01/zookeeper/">Zookeeper安装</a>
          </li>
        
          <li>
            <a href="/2018/11/29/operesty/">OpenrestyTCP反向代理-EQMX高可用</a>
          </li>
        
          <li>
            <a href="/2018/11/29/openssl/">Openssl自建CA</a>
          </li>
        
          <li>
            <a href="/2018/11/29/tomcat/">Tomcat内存溢出跟踪</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2018 lowe zheng<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">主页</a>
  
    <a href="/archives" class="mobile-nav-link">文档库</a>
  
</nav>
    

<script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  <script src="/fancybox/jquery.fancybox.pack.js"></script>


<script src="/js/script.js"></script>



  </div>
</body>
</html>